<template>
  <div class="login-success">
    <div class="card">
      <h1>登录成功</h1>
      <p>欢迎，<span class="nickname">{{ nickname }}</span>!</p>
      <img :src="figureurl" alt="头像" class="avatar" />
      <button @click="goToHome" class="btn">进入首页</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      nickname: '',
      figureurl: ''
    }
  },
  created() {
    const urlParams = new URLSearchParams(window.location.search);
    this.nickname = urlParams.get('nickname');
    this.figureurl = urlParams.get('figureurl');
  },
  methods: {
    goToHome() {
      window.location.href = '/'; // 假设首页路径为 '/'
    }
  }
}
</script>

<style>
body {
  background-color: #f5f7fa;
  font-family: 'Arial', sans-serif;
}
.login-success {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  text-align: center;
  width: 300px;
}

.card h1 {
  color: #333;
  font-size: 24px;
  margin-bottom: 20px;
}

.card p {
  color: #666;
  font-size: 18px;
  margin-bottom: 20px;
}

.card .nickname {
  color: #3498db;
  font-weight: bold;
}

.card .avatar {
  border-radius: 50%;
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
}

.card .btn {
  background-color: #3498db;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  padding: 10px 20px;
  transition: background-color 0.3s;
}

.card .btn:hover {
  background-color: #2980b9;
}
</style>
